package portal.util.string;

import java.text.SimpleDateFormat;
import java.util.Date;

public class StringUtil {

	public static Boolean null2Boolean(Object obj) {
		try {
			return new Boolean(obj == null ? "false" : String.valueOf(obj));
		} catch (Exception e) {
			return new Boolean(false);
		}
	}
	
	public static String null2String(Object obj) {
		return (obj == null ? "" : obj.toString());
	}
	
	public static String formatDate(Date date, String format) {
		SimpleDateFormat dt1 = new SimpleDateFormat(format);
		return dt1.format(date);
	}

}
